<xsl:stylesheet xmlns:x="http://www.w3.org/2001/XMLSchema" xmlns:d="http://schemas.microsoft.com/sharepoint/dsp" version="1.0" exclude-result-prefixes="xsl msxsl ddwrt" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:SharePoint="Microsoft.SharePoint.WebControls" xmlns:ddwrt2="urn:frontpage:internal" xmlns:o="urn:schemas-microsoft-com:office:office" ddwrt:ghost="show_all">
	<xsl:include href="/_layouts/xsl/main.xsl"/>
	<xsl:include href="/_layouts/xsl/internal.xsl"/>
	<xsl:include href="/_layouts/xsl/BoldBrick.SharePoint.CommonControls/CommonTemplates.xsl"/>

	<xsl:param name="AllRows" select="/dsQueryResponse/Rows/Row[$EntityName = '' or (position() &gt;= $FirstRow and position() &lt;= $LastRow)]"/>


	<xsl:param name="CVDocumentContentTypeID">0x01007EE9A3D9714D405EA9E170539992B74B</xsl:param>
	<xsl:param name="InterviewResultContentTypeID">0x0100839DF2AC67584210B7F67FDA4634BA7600B2B6B9FA810141CA9086D6FC37B6CADC</xsl:param>
	<xsl:param name="ReferenceCallResultContentTypeID">0x0100839DF2AC67584210B7F67FDA4634BA76006A24FDBDC5BA43C8A4CE90110F97DEEB</xsl:param>
	<xsl:param name="TestResultContentTypeID">0x0100839DF2AC67584210B7F67FDA4634BA7600D9C14A9DC2A743479773A5B601FB03CB</xsl:param>

	<xsl:template match="View[(@BaseViewID='1')]" mode="full">
		<script type="text/javascript" src="/_layouts/BoldBrick.OneIntranet.HR/JS/Canidates.js">
		</script>
		<link rel="stylesheet" type="text/css" href="/_layouts/BoldBrick.OneIntranet.HR/Style/Candidate.css"/>
		<!--<div />-->
		<!-- Set fields -->
		<xsl:variable name="fields" select="ViewFields/FieldRef[not(@Explicit='TRUE')]"></xsl:variable>
		<xsl:variable name="view" select="."></xsl:variable>

		<div class="candidateMainDiv">
			<!-- Go through all rows -->
			<xsl:for-each select="$AllRows">
				<xsl:variable name="position" select="position()" />
				<xsl:variable name="item" select="." />
				<xsl:variable name="contentTypeID" select="$item/@ContentTypeId" />
				<xsl:variable name="documentID" select="$item/@ID" />
				<xsl:variable name="result" select="$item/@CandidateResult" />

				<!--<xsl:if test="$position > 1">
					<div class="ms-partline">
						<img alt="" src="/_layouts/images/blank.gif" width="1" height="1" />
					</div>
				</xsl:if>-->
				<div class="candidateOneRestult">
					<div class="candidateHeaderDiv">
						<span class="candidateHeaderLink">
							<a onfocus="OnLink(this)" href="{$FORM_DISPLAY}&amp;ID={$documentID}&amp;ContentTypeID={$contentTypeID}"
								onclick="EditLink2(this,{$ViewCounter});return false;" target="_self">
								<xsl:value-of select="$item/@ContentType"/>
								<xsl:if test="$item/@Attachments > 0">
									<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
									<img src="_layouts/images/attach.gif" border="0" alt="$fields[@Name='Attachments']/@DisplayName" />
								</xsl:if>
							</a>
							<xsl:if test="$result != ''">
								<xsl:text> - </xsl:text>
								<xsl:value-of select="$result"/>
							</xsl:if>
						</span>
						<span class="candidateModified">
							<xsl:value-of select="$item/@Modified" disable-output-escaping="yes" />
						</span>
					</div>
					<div class="candidateModifiedBy">
						<span class="candidateModifiedByInner">
							<xsl:call-template name="userAnchorOnly">
								<xsl:with-param name="userElement" select="$item/@Editor" />
							</xsl:call-template>
						</span>
					</div>
					<div>
						<xsl:choose>
							<xsl:when test="starts-with($contentTypeID, $CVDocumentContentTypeID)">
								<xsl:call-template name="CVDocumentView">
									<xsl:with-param name="fields" select="$fields"></xsl:with-param>
								</xsl:call-template>
							</xsl:when>
							<xsl:when test="starts-with($contentTypeID, $InterviewResultContentTypeID)">
								<xsl:call-template name="InterviewResultView">
									<xsl:with-param name="fields" select="$fields"></xsl:with-param>
								</xsl:call-template>
							</xsl:when>
							<xsl:when test="starts-with($contentTypeID, $ReferenceCallResultContentTypeID)">
								<xsl:call-template name="ReferenceCallResultView">
									<xsl:with-param name="fields" select="$fields"></xsl:with-param>
								</xsl:call-template>
							</xsl:when>
							<xsl:when test="starts-with($contentTypeID, $TestResultContentTypeID)">
								<xsl:call-template name="TestResultView">
									<xsl:with-param name="fields" select="$fields"></xsl:with-param>
								</xsl:call-template>
							</xsl:when>
						</xsl:choose>
					</div>
					<!-- Summary -->
					<xsl:call-template name="summaryTemplate">
						<xsl:with-param name="fields" select="$fields" />
					</xsl:call-template>
				</div>
			</xsl:for-each>
		</div>

	</xsl:template>


	<!-- CV Document item template -->
	<xsl:template name="CVDocumentView">
		<xsl:param name="fields"/>
		<xsl:variable name="item" select="." />
		<!-- Document type -->
		<div class="candidateItem">
			<span class="candidateName">
				<xsl:value-of select="$fields[@Name='DocumentTypeLookup']/@DisplayName"></xsl:value-of>
				<xsl:text>: </xsl:text>
			</span>
			<span class="candidateValue">
				<xsl:value-of select="$item/@DocumentTypeLookup" disable-output-escaping="yes" />
			</span>
		</div>
		<!-- Language -->
		<div class="candidateItem">
			<span class="candidateName">
				<xsl:value-of select="$fields[@Name='LanguageLookup']/@DisplayName"></xsl:value-of>
				<xsl:text>: </xsl:text>
			</span>
			<span class="candidateValue">
				<xsl:value-of select="$item/@LanguageLookup" disable-output-escaping="yes" />
			</span>
		</div>
	</xsl:template>

	<!-- Interview result item templates -->
	<xsl:template name="InterviewResultView">
		<xsl:param name="fields"/>
		<xsl:variable name="item" select="." />
		<!-- Interviewer -->
		<div class="candidateItem">
			<span class="candidateName">
				<xsl:value-of select="$fields[@Name='Interviewer']/@DisplayName"></xsl:value-of>
				<xsl:text disable-output-escaping="yes">:&amp;nbsp;</xsl:text>
			</span>
			<span class="candidateValue">
				<xsl:call-template name="userAnchorOnly">
					<xsl:with-param name="userElement" select="$item/@Interviewer.span"></xsl:with-param>
				</xsl:call-template>
			</span>
		</div>
	</xsl:template>
	<xsl:template name="ReferenceCallResultView">
		<xsl:param name="fields"/>
		<xsl:variable name="item" select="." />
		<!-- Name -->
		<div class="candidateItem">
			<span class="candidateName">
				<xsl:value-of select="$item/@ReferenceName" disable-output-escaping="yes" />
				<xsl:text> (</xsl:text>
				<xsl:value-of select="$item/@ReferencePosition" disable-output-escaping="yes" />
				<xsl:text> / </xsl:text>
				<xsl:value-of select="$item/@ReferenceCompany" disable-output-escaping="yes" />
				<xsl:text>)</xsl:text>
			</span>
		</div>
	</xsl:template>
	<xsl:template name="TestResultView">
		<xsl:param name="fields"/>
		<xsl:variable name="item" select="." />
		<div class="candidateItem">
			<!-- Test type -->
			<span class="candidateName">
				<xsl:value-of select="$item/@TestTypeLookup" disable-output-escaping="yes" />
				<xsl:text>:</xsl:text>
			</span>
			<!-- Test result -->
			<span class="candidateValue">
				<xsl:value-of select="$item/@TestResultPoints" disable-output-escaping="yes" />
				<xsl:text> / </xsl:text>
				<xsl:value-of select="$item/@TestResultPointsMax" disable-output-escaping="yes" />
				<xsl:text> = </xsl:text>
				<span class="candidateResultValue">
					<xsl:value-of select="$item/@TestResultPercentage" disable-output-escaping="yes" />
				</span>
			</span>
		</div>
	</xsl:template>

	<!-- Summary template -->
	<xsl:template name="summaryTemplate">
		<xsl:param name="fields"/>
		<xsl:variable name="item" select="." />

		<xsl:if test="$item/@ResultSummary != ''">
			<xsl:variable name="id" select="$item/@ID" />
			<div class="candidateSummary">
				<span class="ms-standardheader">
					<a onclick="javascript:ShowHideGroup(document.getElementById('divSummaryText_{$id}'), document.getElementById('imgPlus_{$id}'));return false;"
						href="javascript:ShowHideGroup()">
						<img id="imgPlus_{$id}" border="0" alt="" src="/_layouts/images/plus.gif" />
						<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
						<xsl:value-of select="$fields[@Name='ResultSummary']/@DisplayName"></xsl:value-of>
					</a>
				</span>
				<div id="divSummaryText_{$id}" style="display: none;" class="candidateSummaryValue">
					<xsl:value-of select="$item/@ResultSummary" disable-output-escaping="yes" />
				</div>
			</div>
		</xsl:if>
	</xsl:template>

	<!-- Disable "Add new item" link below list -->
	<xsl:template name="Freeform" ddwrt:ghost="hide">
	</xsl:template>
</xsl:stylesheet>